<template>
  <div>
    <!-- 面包屑导航 -->
    <Breadcrumb />
    <!-- 卡片视图 -->
    <el-card>
      <el-table :data="rightList" border stripe>
        <el-table-column align="center" type="index" label="序号" width="180">
        </el-table-column>
        <el-table-column
          align="center"
          prop="authName"
          label="权限名称"
          width="180"
        >
        </el-table-column>
        <el-table-column align="center" prop="path" label="路径">
        </el-table-column>
        <el-table-column align="center" prop="pid" label="权限等级">
          <template slot-scope="{ row }">
            <el-tag v-if="row.level === '0'">一级</el-tag>
            <el-tag type="success" v-else-if="row.level === '1'">二级</el-tag>
            <el-tag type="info" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "Rights",
  data() {
    return {
      //权限列表
      rightList: [],
    };
  },
  created() {
    this.getRightList();
  },
  methods: {
    async getRightList() {
      const res = await this.$http.reqRight();
      if (res.meta.status === 200) {
        this.rightList = res.data;
      } else {
        this.$message.error("获取失败");
      }
    },
  },
};
</script>


